{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# <div align='center'> 损失函数 </div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 最小二乘, 残差平方和, MSE"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "参数函数: $h(\\theta_1, \\theta_2, ..., \\theta_m) = \\theta_1x_1 + \\theta_2x_2 + ... + \\theta_mx_m$\n",
    "\n",
    "损失函数: $J(\\theta) = \\dfrac{1}{2m} \\sum\\limits_{i=1}^m{\\big[ h(x^i) - y^i \\big]^2}$\n",
    "\n",
    "\n",
    "偏导: $\\dfrac{\\partial{J(\\theta)}}{\\partial{\\theta_j}} = \\dfrac{1}{m}\\sum\\limits_{i=1}^{m}\\big[h_\\theta(x^i) - y^i \\big] x_j^i $\n",
    "\n",
    "m: 样本数量\n",
    "\n",
    "i: 第i个样本,一般放到右上方标记\n",
    "\n",
    "j: 参数的序号: $\\theta_0, \\theta_1$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "梯度下降更新:\n",
    "\n",
    "$\\theta_j' = \\theta_j - \\alpha \\dfrac{\\partial{J(\\theta)}}{\\partial{\\theta_j}}$\n",
    "$\\alpha$是learning rate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
